package vincent.com.layouttest;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.Random;

import vincent.com.layouttest.view.UVView;

/**
 * Created by zhengwenchen on 2016/5/9.
 */
public class GetDevPropActivity extends ColorStatusActivity {

    @Override
    public View onCreateView(ViewGroup rootView) {
        return LayoutInflater.from(this).inflate(R.layout.activity_get_devprop, rootView, true);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        DisplayMetrics metric = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metric);
        int width = metric.widthPixels;  // 屏幕宽度（像素）
        int height = metric.heightPixels;  // 屏幕高度（像素）
        float density = metric.density;  // 屏幕密度（0.75 / 1.0 / 1.5）
        int densityDpi = metric.densityDpi;  // 屏幕密度DPI（120 / 160 / 240）

        ((TextView)findViewById(R.id.screen_width)).setText("屏幕宽度（像素）---->" + width);
        ((TextView)findViewById(R.id.screen_height)).setText("屏幕高度（像素）---->" + height);
        ((TextView)findViewById(R.id.screen_density)).setText("屏幕密度 ---->" + density);
        ((TextView)findViewById(R.id.screen_dpi)).setText("屏幕dpi ---->" + densityDpi);
    }

    @Override
    public String getToolbarTitle() {
        return "获取设备参数";
    }
}
